#ifndef ZIPWRITER_H
#define	ZIPWRITER_H

#include <stdlib.h>

#include "FileDataExtractor.h"
#include "CentralDirectory.h"

using namespace std;

class ZipWriter
{
public:

    void writeZip(const char* fileName, const char* dest);

private:

    void append_signature(char * buffer, const char* signature);

    template <class t>
    void append(char* buffer, t value, size_t offset);

    void appendFileName(char* buffer, char* name, size_t name_len, size_t offset);

    void appendFileHeader(char *buffer, FileHeader* fHeader);

    void appendContent(char* buffer, unsigned char* content, size_t content_len, size_t offset);

    void appendCentralDirectory(char* cdir_buffer, CentralDirectory* cdirectory);

    void writeEOCentralDirectory(FILE* dest, unsigned int cdir_len, unsigned int cdir_offset);

private:

    FileDataExtractor* fileDataExtractor;
};
#endif	/* ZIPWRITER_H */
